Skip to content

Conversation

@utkarshdalal
Copy link
Owner

@utkarshdalal utkarshdalal commented Jan 23, 2026

Summary by cubic

Fixes “sync in progress” deadlocks by switching to per-app sync locks and adds a “launch anyway” path when cloud sync is busy. Also improves game shutdown by exiting the container cleanly and forces the correct executable to fullscreen.

  • Bug Fixes

    • Replaced global sync flag with per-app AtomicBoolean locks; always released in finally; hasActiveOperations checks per-app state.
    • Prevented launch/close from blocking across apps; better warnings include appId.
    • Exits container when the game quits by polling process list until only essential services remain; cancels watcher on dispose.
    • Forces fullscreen using container.executablePath to avoid wrong window class.
  • New Features

    • Added SYNC_IN_PROGRESS dialog with “Launch anyway” or “Wait”; preLaunchApp supports skipCloudSync and added localized strings.

Written for commit 4e47188. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Added option to launch games without waiting when cloud synchronization is already in progress for that title, with warning about potential save conflicts
    • New "Launch Anyway" and "Wait" dialog options during sync operations
  • Improvements

    • Enhanced cloud synchronization handling for individual games
    • Added multilingual support for new sync-related UI messages across 10 languages

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

This PR implements per-app synchronization tracking in SteamService using a ConcurrentHashMap to manage concurrent operations on different apps, and introduces a new dialog flow that allows users to launch an app even when cloud sync is in progress, with corresponding localization strings across multiple languages.

Changes

Cohort / File(s) Summary
Service Synchronization Mechanism
app/src/main/java/app/gamenative/service/SteamService.kt
Replaced global sync flag with per-app ConcurrentHashMap<Int, AtomicBoolean>. Added tryAcquireSync, releaseSync, and hasActiveOperations helpers. Integrated acquire/release logic into launch, force sync, and close app flows with try-finally blocks to ensure cleanup. Updated error handling to return InProgress when a sync is already active for a specific appId.
UI Dialog Flow
app/src/main/java/app/gamenative/ui/PluviaMain.kt
Added new DialogType.SYNC_IN_PROGRESS state with confirm/dismiss handlers. Introduced skipCloudSync parameter to preLaunchApp function (default false) to bypass Steam Cloud sync. When skipCloudSync is true, app launches immediately without sync; when sync is in progress, shows dialog prompting user to launch anyway or wait.
Dialog Type Enumeration
app/src/main/java/app/gamenative/ui/enums/DialogType.kt
Added SYNC_IN_PROGRESS enum constant to represent the new in-progress sync dialog state.
Localization Strings
app/src/main/res/values.*/strings.xml (10 files: da, de, fr, it, pt-rBR, ro, uk, zh-CN, zh-TW, values)
Added three new string resources across all language variants: main_sync_in_progress_launch_anyway_message (descriptive message about in-progress sync with launch-anyway option), main_launch_anyway (action label), and main_wait (action label).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as PluviaMain UI
    participant Service as SteamService
    participant Dialog as Dialog Flow

    User->>UI: Attempt to Launch App
    UI->>Service: preLaunchApp(appId)
    Service->>Service: tryAcquireSync(appId)
    
    alt Sync Already In Progress
        Service-->>UI: InProgress Result
        UI->>Dialog: Show SYNC_IN_PROGRESS Dialog
        User->>Dialog: Choose Action
        
        alt User Selects "Launch Anyway"
            Dialog->>UI: preLaunchApp(skipCloudSync=true)
            UI->>Service: beginLaunchApp (without sync)
            Service-->>UI: Launch Success
            Service->>Service: releaseSync(appId)
        else User Selects "Wait"
            Dialog-->>User: Dismiss Dialog
        end
    else Sync Not In Progress
        Service->>Service: Proceed with Cloud Sync
        Service-->>UI: Sync Success
        UI->>UI: Launch App
        Service->>Service: releaseSync(appId)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Per-app sync flags hop along the way,
Each app gets its own turn to play,
When sync is stuck, a choice rings clear:
Launch anyway, or wait right here! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Syncing fix' is vague and generic, lacking specificity about what syncing issue is being addressed or which component is affected. Revise the title to be more descriptive, e.g., 'Replace global sync flag with per-app synchronization locks' or 'Fix sync deadlock by implementing per-app sync state tracking'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@app/src/main/res/values-da/strings.xml`:
- Around line 578-580: The Danish string
main_sync_in_progress_launch_anyway_message uses "Cloud-synkronisering" but
other strings use "Sky-synkronisering"; update the message text to replace
"Cloud-synkronisering" with "Sky-synkronisering" so terminology is consistent
with existing keys like library_cloud_sync_*, keeping the rest of the sentence
intact and leaving string name main_sync_in_progress_launch_anyway_message,
main_launch_anyway and main_wait unchanged.

Comment on lines +578 to +580
<string name="main_sync_in_progress_launch_anyway_message">Cloud-synkronisering for dette spil er allerede i gang. Du kan vente og prøve igen eller starte alligevel uden synkronisering (kan give konflikter i gemte filer).</string>
<string name="main_launch_anyway">Start alligevel</string>
<string name="main_wait">Vent</string>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Align terminology with existing “Sky‑synkronisering”.

Other Danish strings use “Sky‑synkronisering” (e.g., library_cloud_sync_*), but this new line says “Cloud‑synkronisering”. Consider aligning for consistency.

♻️ Suggested tweak
-    <string name="main_sync_in_progress_launch_anyway_message">Cloud-synkronisering for dette spil er allerede i gang. Du kan vente og prøve igen eller starte alligevel uden synkronisering (kan give konflikter i gemte filer).</string>
+    <string name="main_sync_in_progress_launch_anyway_message">Sky-synkronisering for dette spil er allerede i gang. Du kan vente og prøve igen eller starte alligevel uden synkronisering (kan give konflikter i gemte filer).</string>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<string name="main_sync_in_progress_launch_anyway_message">Cloud-synkronisering for dette spil er allerede i gang. Du kan vente og prøve igen eller starte alligevel uden synkronisering (kan give konflikter i gemte filer).</string>
<string name="main_launch_anyway">Start alligevel</string>
<string name="main_wait">Vent</string>
<string name="main_sync_in_progress_launch_anyway_message">Sky-synkronisering for dette spil er allerede i gang. Du kan vente og prøve igen eller starte alligevel uden synkronisering (kan give konflikter i gemte filer).</string>
<string name="main_launch_anyway">Start alligevel</string>
<string name="main_wait">Vent</string>
🤖 Prompt for AI Agents
In `@app/src/main/res/values-da/strings.xml` around lines 578 - 580, The Danish
string main_sync_in_progress_launch_anyway_message uses "Cloud-synkronisering"
but other strings use "Sky-synkronisering"; update the message text to replace
"Cloud-synkronisering" with "Sky-synkronisering" so terminology is consistent
with existing keys like library_cloud_sync_*, keeping the rest of the sentence
intact and leaving string name main_sync_in_progress_launch_anyway_message,
main_launch_anyway and main_wait unchanged.

@utkarshdalal utkarshdalal merged commit 019a017 into master Jan 23, 2026
2 checks passed
@utkarshdalal utkarshdalal deleted the syncing-fix branch January 23, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants